<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<jsp:include page="global.jsp"></jsp:include>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>岗位权限管理</title>
<style type="text/css">
.ctl{
	text-decoration: none;
	color: blue;
	margin: auto 7px;
}
.ctl:HOVER{
	text-decoration: underline;
}
.center{
	text-align: center;
}
</style>
</head>
<body>
	<div class="easyui-panel" title="岗位管理&gt;&gt;岗位权限设置" style="width:100%;height:100%;padding:0px;margin:0px" data-options="fit:true,border:false">
		 <div>
			<a href="positionmgr" class="easyui-linkbutton" data-options="iconCls:'icon-back',plain:true">返回</a>
		</div>
		 <div>岗位名称：${position.name}</div>
		 <div>
			 <form id="mainForm" name="mainForm" method="post" action="addPositionAuthority">
				 <input type="hidden" name="positionId" value="${position.id}"/>
				 <table>
					<tr>
		           		<td>
			           		<select multiple="true" name="availableIds" ondblclick="addIds()" style="width:250px;height:400px">
								<c:forEach var="item" items="${availableAuthorities}" >
									<option value = "${item.id }">${item.name }</option>
								</c:forEach>
							</select>
		           		</td>
		           		<td>
			           		<div style="padding:5px">
			           			<a href="javascript:addIds()" class="easyui-linkbutton">&gt;&gt;</a>
			           		</div>
			           		<div style="padding:5px">
			           			<a href="javascript:removeIds()" class="easyui-linkbutton">&lt;&lt;</a>
			           		</div>
		           		</td>
		           		<td>
			           		<select multiple="true" name="selectedIds" ondblclick="removeIds()" style="width:250px;height:400px">
								<c:forEach var="item" items="${selectedAuthorities}" >
									<option value = "${item.id }">${item.name }</option>
								</c:forEach>
							</select>
		           		</td>
		           </tr>
		    	</table>
	    	</form>
    	</div>
	</div>

	<script type="text/javascript">
	function addIds(){
		document.forms['mainForm'].action = "addPositionAuthority";
		document.forms['mainForm'].submit();
	}
	function removeIds(){
		document.forms['mainForm'].action = "removePositionAuthority";
		document.forms['mainForm'].submit();
	}
	</script>
</body>
</html>